"""
@author: 江同学呀
@file: highlight_common.py
@date: 2025/1/20 20:45
@desc: 
"""

from espc.utils.enum_utils import EnumBase


class BoundaryScanner(EnumBase):
    """

    """
    chars = "chars"
    """
    Use the characters specified by boundary_chars as highlighting boundaries. The boundary_max_scan setting controls 
    how far to scan for boundary characters. Only valid for the fvh highlighter.
    使用 boundary_chars 指定的字符作为高亮显示边界。boundary_max_scan 设置控制扫描边界字符的距离。仅对 fvh 荧光笔有效。
    """
    sentence = "sentence"
    """
    Break highlighted fragments at the next sentence boundary, as determined by Java’s BreakIterator. You can specify 
    the locale to use with boundary_scanner_locale.
    在下一个句子边界处断开高亮显示的片段，由 Java 的 BreakIterator 确定。您可以指定要用于 boundary_scanner_locale 的区域设置。
    """
    word = "word"
    """
    Break highlighted fragments at the next word boundary, as determined by Java’s BreakIterator. You can specify the 
    locale to use with boundary_scanner_locale.
    在下一个单词边界处断开高亮显示的片段，由 Java 的 BreakIterator 确定。您可以指定要用于 boundary_scanner_locale 的区域设置。
    """


class Fragmenter(EnumBase):
    """
    碎片

    Specifies how text should be broken up in highlight snippets: simple or span. Only valid for the plain highlighter.
    Defaults to span.
    指定文本在高亮片段中应如何拆分：simple 或 span。仅对普通荧光笔有效。默认为 span。
    """
    simple = "simple"
    """
    Breaks up text into same-sized fragments.
    将文本拆分为大小相同的片段。
    """
    span = "span"
    """
    Breaks up text into same-sized fragments, but tries to avoid breaking up text between highlighted terms. This is 
    helpful when you’re querying for phrases. Default.
    将文本拆分为大小相同的片段，但尽量避免在突出显示的字词之间拆分文本。这在查询短语时非常有用。违约。
    """


class HighlightType(EnumBase):
    """
    高亮类型
    """
    unified = "unified"
    plain = "plain"
    fvh = "fvh"


class HighlightOrder(EnumBase):
    """
    次序

    Sorts highlighted fragments by score when set to score. By default, fragments will be output in the order they
    appear in the field (order: none). Setting this option to score will output the most relevant fragments first.
    Each highlighter applies its own logic to compute relevancy scores. See the document How highlighters work
    internally for more details how different highlighters find the best fragments.
    设置为 score 时，按分数对突出显示的片段进行排序。默认情况下，片段将按它们在字段中的显示顺序输出（顺序：none）。将此选项设置为 score
    将首先输出最相关的片段。每个荧光笔都应用自己的逻辑来计算相关性分数。有关不同荧光笔如何查找最佳片段的更多详细信息，请参阅文档 荧光笔在内
    部的工作原理。
    """
    none = "none"
    score = "score"


